import Vue from 'vue'
import Router from './myRouter'

Vue.use(Router)
const routes = [
    {
        path: '/', component: () => import('@/view/layout'),
        children: [
            {
                path: 'dashbody',
                component: () => import('@/view/dashbody'),

            }
        ]
    },
    {
        path: '/bar', component: () => import('@/components/index.vue'),
        children: [
            {
                path: 'hello-world',
                component: () => import('@/components/HelloWorld.vue'),

            }
        ]
    }
]


const createRouter = () => new Router({
    mode: 'hash', // require service support
    routes
})

const router = createRouter()

// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
export function resetRouter() {
    const newRouter = createRouter()
    router.matcher = newRouter.matcher // reset router
}

export default router
